// Learn cc.Class:
//  - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

var AudioManager = require('AudioManager')

cc.Class({
    extends: cc.Component,

    properties: {
        bgm: {
            type: cc.AudioClip,
            default: null
        },
        gameBgm: {
            type: cc.AudioClip,
            default: null
        }
    },

    _play () {
        cc.audioEngine.playMusic(this.bgm, true)
        var results = AudioManager.getVolume()
        cc.audioEngine.setMusicVolume(results.music)
    },

    _playGame () {
        cc.audioEngine.playMusic(this.gameBgm, true)
        var results = AudioManager.getVolume()
        cc.audioEngine.setMusicVolume(results.music)
    }
});
